package com.wiscamp.ninechapters.problems.infrastructure.mappers.problems;

import com.wiscamp.ninechapters.problems.infrastructure.po.problems.StemPO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * 题干仓储对象
 *
 * @author yifeng
 */
@Repository
public interface StemMapper extends JpaRepository<StemPO, Long>, JpaSpecificationExecutor<StemPO> {

    /**
     * 通过题编号获取题干
     *
     * @param itemId
     * @return
     */
    @Query(value = "select e from StemPO e where e.problemId = :problemId")
    StemPO findByProblem(long problemId);
}